<?php
if($entrance_test_result){
	$reading_number_right = set_value('reading_number_right',$entrance_test_result->reading_number_right);
	$reading_scaled_score = set_value('reading_scaled_score',$entrance_test_result->reading_scaled_score);
	$reading_grade_equivalent = set_value('reading_grade_equivalent',$entrance_test_result->reading_grade_equivalent);
	$reading_percentile_rank = set_value('reading_percentile_rank',$entrance_test_result->reading_percentile_rank);
	$reading_stanine = set_value('reading_stanine',$entrance_test_result->reading_stanine);
	$reading_instructional_level = set_value('reading_instructional_level',$entrance_test_result->reading_instructional_level);
	$math_number_right = set_value('math_number_right',$entrance_test_result->math_number_right);
	$math_scaled_score = set_value('math_scaled_score',$entrance_test_result->math_scaled_score);
	$math_grade_equivalent = set_value('math_grade_equivalent',$entrance_test_result->math_grade_equivalent);
	$math_percentile_rank = set_value('math_percentile_rank',$entrance_test_result->math_percentile_rank);
	$math_stanine = set_value('math_stanine',$entrance_test_result->math_stanine);
	$language_number_right = set_value('language_number_right',$entrance_test_result->language_number_right);
	$language_scaled_score = set_value('language_scaled_score',$entrance_test_result->language_scaled_score);
	$language_grade_equivalent = set_value('language_grade_equivalent',$entrance_test_result->language_grade_equivalent);
	$language_percentile_rank = set_value('language_percentile_rank',$entrance_test_result->language_percentile_rank);
	$language_stanine = set_value('language_stanine',$entrance_test_result->language_stanine);
	$basic_battery_number_right = set_value('basic_battery_number_right',$entrance_test_result->basic_battery_number_right);
	$basic_battery_scaled_score = set_value('basic_battery_scaled_score',$entrance_test_result->basic_battery_scaled_score);
	$basic_battery_grade_equivalent = set_value('basic_battery_grade_equivalent',$entrance_test_result->basic_battery_grade_equivalent);
	$basic_battery_percentile_rank = set_value('basic_battery_percentile_rank',$entrance_test_result->basic_battery_percentile_rank);
	$basic_battery_stanine = set_value('basic_battery_stanine',$entrance_test_result->basic_battery_stanine);
	$esl = set_value('esl',$entrance_test_result->esl);
	$summer_school = set_value('summer_school',$entrance_test_result->summer_school);
	$star_program = set_value('star_program',$entrance_test_result->star_program);
	$duration = set_value('duration',$entrance_test_result->duration);
	$retain_level = set_value('retain_level',$entrance_test_result->retain_level);
	
	$btn_label = "Update Entrance Test Result";
	$btn_name = "update_entrance_test_result";
}else{
	$reading_number_right = '';
	$reading_scaled_score = '';
	$reading_grade_equivalent = '';
	$reading_percentile_rank = '';
	$reading_stanine = '';
	$reading_instructional_level = '';
	$math_number_right = '';
	$math_scaled_score = '';
	$math_grade_equivalent = '';
	$math_percentile_rank = '';
	$math_stanine = '';
	$language_number_right = '';
	$language_scaled_score = '';
	$language_grade_equivalent = '';
	$language_percentile_rank = '';
	$language_stanine = '';
	$basic_battery_number_right = '';
	$basic_battery_scaled_score = '';
	$basic_battery_grade_equivalent = '';
	$basic_battery_percentile_rank = '';
	$basic_battery_stanine = '';
	$esl = '';
	$summer_school = '';
	$star_program = '';
	$duration = '';
	$retain_level = '';
	
	$btn_label = "Insert Entrance Test Result";
	$btn_name = "insert_entrance_test_result";
}
?>

<div>
<div class="panel callout"><h6>Entrance Test Result</h6></div>

<?php
if(!empty($applicants)):
?>
	
<div class="inner-border">

	<div>
	<legend>Score Summary Box<br/></legend>
	</div>
	<div class="clearfix"></div>
	<div>
	<table class="responsive">
		<tr>
			<td style="text-align:center;">Test</td>
			<td style="text-align:center;">Number Right</td>
			<td style="text-align:center;">Scaled Score</td>
			<td style="text-align:center;">Grade Equivalent</td>
			<td style="text-align:center;">Percentile Rank</td>
			<td style="text-align:center;">Stanine</td>
			<td style="text-align:center;">Instructional Reading Level</td>
		</tr>
		<tr>
			<td>Reading</td>
			<td><input type="text" name="reading_number_right" value="<?=$reading_number_right;?>" /></td>
			<td><input type="text" name="reading_scaled_score" value="<?=$reading_scaled_score;?>" /></td>
			<td><input type="text" name="reading_grade_equivalent" value="<?=$reading_grade_equivalent;?>" /></td>
			<td><input type="text" name="reading_percentile_rank" value="<?=$reading_percentile_rank;?>" /></td>
			<td><input type="text" name="reading_stanine" value="<?=$reading_stanine;?>" /></td>
			<td><input type="text" name="reading_instructional_level" value="<?=$reading_instructional_level;?>" /></td>
		</tr>
		<tr>
			<td>Mathematics</td>
			<td><input type="text" name="math_number_right" value="<?=$math_number_right;?>" /></td>
			<td><input type="text" name="math_scaled_score" value="<?=$math_scaled_score;?>" /></td>
			<td><input type="text" name="math_grade_equivalent" value="<?=$math_grade_equivalent;?>" /></td>
			<td><input type="text" name="math_percentile_rank" value="<?=$math_percentile_rank;?>" /></td>
			<td><input type="text" name="math_stanine" value="<?=$math_stanine;?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>Language</td>
			<td><input type="text" name="language_number_right" value="<?=$language_number_right;?>" /></td>
			<td><input type="text" name="language_scaled_score" value="<?=$language_scaled_score;?>" /></td>
			<td><input type="text" name="language_grade_equivalent" value="<?=$language_grade_equivalent;?>" /></td>
			<td><input type="text" name="language_percentile_rank" value="<?=$language_percentile_rank;?>" /></td>
			<td><input type="text" name="language_stanine" value="<?=$language_stanine;?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>Basic Battery<br />(R + M + L)</td>
			<td><input type="text" name="basic_battery_number_right" value="<?=$basic_battery_number_right;?>" /></td>
			<td><input type="text" name="basic_battery_scaled_score" value="<?=$basic_battery_scaled_score;?>" /></td>
			<td><input type="text" name="basic_battery_grade_equivalent" value="<?=$basic_battery_grade_equivalent;?>" /></td>
			<td><input type="text" name="basic_battery_percentile_rank" value="<?=$basic_battery_percentile_rank;?>" /></td>
			<td><input type="text" name="basic_battery_stanine" value="<?=$basic_battery_stanine;?>" /></td>
			<td>&nbsp;</td>
		</tr>
	</table>
	</div>
	
	<div class="clearfix"></div>
	<!--
	<div>
	<legend>Requirements for Admission:<br/></legend>
	</div>
	<div>
	<table style="border:0px;">
		<tr>
			<td>
				<?php if($esl){ ?>
				<?=form_checkbox('esl', 'yes', TRUE);?>
				<?php }else{ ?>
				<?=form_checkbox('esl', 'yes');?>
				<?php } ?>
			</td>
			<td>
				ESL (English as Second Language)
			</td>
		</tr>
	</table>
	<table style="border:0px;">
		<tr>
			<td>
				<?php if($summer_school){ ?>
				<?=form_checkbox('summer_school', 'yes', TRUE);?>
				<?php }else{ ?>
				<?=form_checkbox('summer_school', 'yes');?>
				<?php } ?>
			</td>
			<td>
				Summer School
			</td>
		</tr>
	</table>
	<table style="border:0px;">
		<tr>
			<td>
				Star Program in
			</td>
			<td>
				<input type="text" name="star_program" value="<?=$star_program;?>" />
			</td>
			<td>
				Duration
			</td>
			<td>
				<input type="text" name="duration" value="<?=$duration;?>" />
			</td>
		</tr>
	</table>
	<table style="border:0px;">
		<tr>
			<td>
				Retain in level
			</td>
			<td>
				<input type="text" name="retain_level" value="<?=$retain_level;?>" />
			</td>
		</tr>
	</table>
	</div>
	
	<div class="clearfix"></div>
	-->
	<!-- End of entrance test result -->

	<div>
		<input type="hidden" name="e_id" value="<?=$applicants->e_id;?>">
		<input type="submit" name="<?=$btn_name?>" value="<?=$btn_label?>" class="button tiny">
	</div>
</div>

<?php else:?>
	<div class="alert-box">
		<h1>Invalid student.</h1>
	</div>
<?php endif;?>
</div>